<?php
namespace Admin\Controller;

use Think\Page;
use THink\Controller;

class EnrollController extends Controller
{
	protected $model = null;

	public function __construct()
	{
		parent::__construct();
		$this->model = M('Enroll');
	}

	public function index()
	{
		$where = [];

        // 查找
        $name = I('get.name', 0, 'trim');
        if ($name ) {

            $where['name']  = ['LIKE', '%' . $name . '%'];
            $fields['name'] = $name;
            $this->assign('name', $name);
        }

        $count = $this->model->where($where)->count();
        $this->assign('count', $count);

        $pages = new Page($count, C('PAGE'), $fields);
        $this->assign('pages', $pages->show());

        $datas = $this->model->where($where)->limit($pages->firstRow . ',' . $pages->listRows)->select();
        $this->assign('datas', $datas);

        $this->assign('bread_crumb', $bread_crumb = generate_bread_crumb([
            '活动管理',
            '报名列表',
        ]));
        $this->display();
	}

	

}